package cn.com.tarotframework.server.oauth.controller;


import cn.com.tarotframework.server.oauth.dto.LoginDto;
import cn.com.tarotframework.server.oauth.service.ILoginService;
import cn.com.tarotframework.server.oauth.vo.LoginVo;
import cn.com.tarotframework.utils.response.TarotResponseResultBody;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.validation.Valid;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * copyright (C), 2022, 塔罗牌基础架构
 *
 * @program tarot-core
 * @description 用户信息控制层
 * @author Jiang Xincan
 * @version 0.0.1
 * @create 2024/01/20 18:54
 **/
@Validated
@Tag(name = "登录信息管理", description = "系统登录模块")
@RestController
@RequestMapping("login")
@TarotResponseResultBody
public class LoginController {

    private final ILoginService loginService;

    public LoginController(ILoginService loginService) {
        this.loginService = loginService;
    }

    @Operation(summary = "用户登录", method = "POST", description = "根据用户名称、用户密码登录系统")
    @PostMapping("in")
    public LoginVo in(@Valid @RequestBody LoginDto loginDto) {
        return loginService.in(loginDto);
    }

}
